import { defineStore } from 'pinia';
import { ref } from 'vue';
import type { CommandSender } from '../commandHelper';

type SendTaskCmd = CommandSender<any, any> | null;

// 1. 先按原来的方式定义Store（完全不变）
export const useTaskStore = defineStore('taskInjection', () => {
  const sendTaskCmd = ref<SendTaskCmd>(null);

  const setInjections = (injections: { sendTaskCmd?: SendTaskCmd }) => {
    if (injections.sendTaskCmd) {
      sendTaskCmd.value = injections.sendTaskCmd;
    }
  };

  return { sendTaskCmd, setInjections };

});